package me.muci.factoryPattern.staticFactoryMethod;

import me.muci.factoryPattern.staticFactoryMethod.factory.OperationFactory;

/**
 * ClassName: Test <br/>
 * Description: <br/>
 * date: 2021/8/4 11:36<br/>
 *
 * @author muci<br />
 * @description
 * @since JDK 1.8
 */
public class Test {

    @org.junit.Test
    public void test(){
        System.out.println(" ====普通方式:使用哪个,new哪个==== ");
        OperationAdd add = new OperationAdd();
        add.setValue1(1.1);
        add.setValue2(2.2);
        System.out.println("add.getResults() = " + add.getResults());
        System.out.println(" ====简单工厂模式,使用工厂类创建====");
        Operation operation = OperationFactory.createOperation("+");
        operation.setValue1(1.1d);
        operation.setValue2(2.2d);
        System.out.println("operation.getResults() = " + operation.getResults());
    }

}
